﻿Imports SMSClasses
Imports System.IO

Public Class frmSettings

    Private Sub Form2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        Me.txtIn.Text = My.Settings.in_box
        Me.txtOut.Text = My.Settings.out_box

    End Sub

    Private Sub btnBrowseIn_Click(sender As System.Object, e As System.EventArgs) Handles btnBrowseIn.Click

        Dim fb As New FolderBrowserDialog

        With fb
            .RootFolder = Environment.SpecialFolder.UserProfile
            .Description = "Select DropBox sms_inbox Folder"
            If .ShowDialog = DialogResult.OK Then
                Me.txtIn.Text = .SelectedPath & "\"
            End If
        End With

    End Sub

    Private Sub btnBrowse_Click(sender As System.Object, e As System.EventArgs) Handles btnBrowse.Click

        Dim fb As New FolderBrowserDialog

        With fb
            .RootFolder = Environment.SpecialFolder.UserProfile
            .Description = "Select DropBox sms_outbox Folder"
            If .ShowDialog = DialogResult.OK Then
                Me.txtOut.Text = .SelectedPath & "\"
            End If
        End With


    End Sub



    Private Sub btnCancel_Click(sender As System.Object, e As System.EventArgs) Handles btnCancel.Click

        Me.Close()

    End Sub

    Private Sub btnOK_Click(sender As System.Object, e As System.EventArgs) Handles btnOK.Click

        If Me.txtIn.Text = "" Or Me.txtOut.Text = "" Then
            MsgBox("You must set these paths for the application to work", MsgBoxStyle.OkOnly + MsgBoxStyle.Information)
            Return
        End If

        My.Settings.in_box = Me.txtIn.Text
        My.Settings.out_box = Me.txtOut.Text
        Me.Close()

    End Sub
End Class